<#include '/admin/header.html' >

<div class="main">
	<div class="shadowBoxWhite  whiteBox">
		<form method="post" id="dataForm" >
			<#if isEdit > <input type="hidden" name="dataid" value="${dataid}" />
			<input type="hidden" id="dataAction"
				value="${ctx}/cms/admin/data/save-edit.do?ajax=yes&modelid=${modelid}" /> <#else> <input
				type="hidden" id="dataAction"
				value="${ctx}/cms/admin/data/save-add.do?ajax=yes&modelid=${modelid!''}" /> </#if>

			<table cellspacing="1" cellpadding="3" width="100%" style="border-collapse:collapse;" border='1' bordercolor="#d7d7d7" class="form-table">
				<tr>
					<th><label class="text">所属分类：</label>
					</th>
					<td><select name="catid">
							<option value="${catid}" selected><#if cat??>${cat.name}</#if></option> 
							<#assign children=catList /> 
							<#assign level=1 />
							<#include 'select_children.html' />
					</select></td>
				</tr>
				<tr>
					<th><label class="text">权重：</label>
					</th>
					<td><input type="text" class="easyui-numberbox input_text" maxlength="9"
						data-options="required:true" name="sort" style="width: 50px"<#if
						isEdit >value="${(article.sort?c)!0}"</#if> /> 权重越高则越靠前显示</td>
				</tr>

				<tr>
					<th><label class="text">页面标题：</label>
					</th>
					<td><input maxlength="20"  type="text" class="easyui-validatebox input_text"
						data-options="required:true" name="page_title"
						style="width: 250px" <#if isEdit >value="${article.page_title!''}"</#if>/></td>
				</tr>
				<tr>
					<th><label class="text">页面关键字：</label>
					</th>
					<td><input maxlength="20" type="text" class="input_text easyui-validatebox" name="page_keywords" data-options="required:true"
						style="width: 250px"<#if isEdit
						>value="${article.page_keywords!''}"</#if> /></td>
				</tr>
				<tr>
					<th><label class="text">页面描述：</label>
					</th>
					<td>
						<script id="editor1" name="page_description" type="text/plain" style="height:200px;width: 99%;">
							<#if isEdit  >${article.page_description!''}</#if>
						</script>
					</td>
				</tr>
				
				<#if fieldList ??> 
				<#list fieldList as field >
				<tr>
					<th><label class="text">${field.china_name}：</label>
					</th>
					<td>${field.inputHtml}</td>
				</tr>
				</#list> 
				</#if>
			</table>
		</form>
		<div class="buttonWrap">
			<a href="javascript:;" id="datainput" class="easyui-linkbutton">保存</a>
		</div>
	</div>
</div>
<script type="text/javascript">

var ue = UE.getEditor('editor1',{
	zIndex:0,
});

	$(function() {
		
		$("#datainput").click(function() {
			var dataurl = $("#dataAction").val();
			var formflag = $("#dataForm").form('validate');
			if (formflag) {
				$.Loading.show("正在保存,请稍候");
				$("#datainput").linkbutton("disable");
				var options = {
					url : dataurl,
					type : "POST",
					dataType : 'json',
					success : function(result) {
						if (result.result == 1) {
							$.Loading.success(result.message);
							if( dataurl == "${ctx}/cms/admin/data/save-add.do?ajax=yes&modelid=${modelid!''}" ){
								parent.reloadTabGrid("文章列表");
								parent.reloadTabGrid("商城公告");
								parent.reloadTabGrid("联系平台");
								parent.reloadTabGrid("联系方式");
								parent.reloadTabGrid("热门关键字");
								parent.CloseTabByTitle("添加文章");
							}
						}
						if (result.result == 0) {
							$.Loading.error(result.message);
						}
						$("#datainput").linkbutton("enable");
					},
					error : function(e) {
						$.Loading.error("出现错误 ，请重试");
						$("#datainput").linkbutton("enable");
					}
				};
				$('#dataForm').ajaxSubmit(options);
			} else {
				$.Loading.hide();
				$("#datainput").linkbutton("enable");
			}
		});
	});
</script>
<#include '/admin/footer.html' >
